class Vector:
    def __init__(self, x, y):
        self.x = x
        self.y = y

    def __add__(self, other):
        print("__add__被自动调用!")
        return Vector(self.x + other.x, self.y + other.y)

    def __lt__(self, other):
        print("__lt__被自动调用!")
        return (self.x ** 2 + self.y ** 2) < (other.x ** 2 + other.y ** 2)

    def __str__(self):
        print("__str__被自动调用!")
        return f"Vector({self.x}, {self.y})"


v1 = Vector(1, 2)
v2 = Vector(3, 4)

# 自动调用特殊方法
result = v1 + v2  # 自动调用 v1.__add__(v2)
print(result)  # 自动调用 result.__str__()

comparison = v1 < v2  # 自动调用 v1.__lt__(v2)
print(comparison)